/**
 * Copyright (C) 2016 Hyphenate Inc. All rights reserved.
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.srwl.mytx.activity.ConversationActivity;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.ProgressBar;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.srwl.easeui.widget.MyTitleBar;
import com.srwl.mytx.Constant;
import com.srwl.mytx.R;
import com.srwl.mytx.activity.BaseActivity;
import com.srwl.mytx.adapter.NotifyMessageInteractionListener;
import com.srwl.mytx.adapter.TaskNotifyAdapter;
import com.srwl.mytx.im.conversation.Conversation;
import com.srwl.mytx.domain.Message;
import com.srwl.mytx.domain.User;
import com.srwl.mytx.im.ConversationService;
import com.srwl.mytx.im.IMSClientBootstrap;
import com.srwl.mytx.widget.ConfirmDialog;

import java.util.ArrayList;
import java.util.List;

import me.dkzwm.widget.srl.MaterialSmoothRefreshLayout;
import me.dkzwm.widget.srl.SmoothRefreshLayout;

/**
 * 悬赏任务通知页面
 */
public class TaskNotifyActivity extends SystemNotifyActivity {
    public static final int REQUEST_CODE_TO_TASK_DETAIL = 2;

    @NonNull
    @Override
    protected void initConversation() {
        conversation = conversationService.getNotifyConversation(Constant.CONVERSATION_TYPE_TASK);
        adapter = new TaskNotifyAdapter(this, notifyList, this);
    }


    //    @Override
//    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
//        super.onActivityResult(requestCode, resultCode, data);
//
//        if (resultCode != RESULT_OK) {
//            return;
//        }
//        if (requestCode == REQUEST_CODE_TO_TASK_DETAIL) {
//            Task updateTask = data.getParcelableExtra(Constant.EXTRA_INFO_TASK);
//            if (updateTask == null) {
//                return;
//            }
//            for (int i = 0; i < notifyList.size(); i++) {
//                Message notify = notifyList.get(i);
//                if (notify.getSubType() == Constant.PUSH_MESSAGE_TASK_INFO) {//成功支付定单的返回结果
//                    Task task = JSONObject.parseObject(notify.getExtraData(), Task.class);
//                    if (task == null) {
//                        continue;
//                    }
//                    if (TextUtils.equals(updateTask.getId(), task.getId())) {
//
//                        if ((updateTask.getUpdated() == null && task.getUpdated() != null) || (updateTask.getUpdated() != null && task.getUpdated() != null && updateTask.getUpdated().before(task.getCreated()))) {//说明回传的任务信息已经过时，不能覆盖最新信息，直接 break,
//                            break;
//                        }
//                        task.setStatus(updateTask.getStatus());
//                        notify.setExtraData(JSONObject.toJSONString(task));
//                        adapter.notifyItemChanged(i);
//                        DBManager.getInstance().getDaoSession().getMessageDao().update(notify);
//                        break;
//                    }
//                }
//            }
//
//        }
//
//    }

}
